package com.vue.demo.page;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author zhuliangcai
 * @Email 1024955966@qq.com
 * @Date 2017-10-16 08:35:14
 */
@RestController
public class VueController {
	static List<Map<String, Object>> list = new ArrayList<>();
	static {
		for(int i=0;i<100;i++) {
			Map<String, Object> map1 = new HashMap<>();
			map1.put("id", i+1);
			map1.put("value1", "data-"+i);
			map1.put("value2", "other-"+i);
			list.add(map1);
		}
	}

	@RequestMapping("/listData")
	public Map<String, Object> findPage(int pageNum, int pageSize) {
		Map<String, Object> map = new HashMap<>();

		map.put("total", list.size());
		map.put("list", list.subList((pageNum - 1) * pageSize, pageNum * pageSize - 1));

		return map;
	}

}
